﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using BIPorter.Common.BLL;
using BIPorter.Common.CommonFilter;
using BIPorter.Common.Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace BIPorter.Common
{
    [BIAuthorizeFilter]
    public class BaseController : Controller
    {

        #region 属性

        public AccountModel CurrentUser
        {
            get
            {
                return AccountBll.GetCurrentUser();
            }
        }

        #endregion

        #region 方法
        /// <summary>
        /// 返回处理过时间的json
        /// </summary>
        /// <param name="Data"></param>
        /// <returns></returns>
        protected ContentResult JsonWithDate(object Data)
        {
            var timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss.fff" };

            return Content(JsonConvert.SerializeObject(Data, Formatting.Indented, timeConverter));
        }
        #endregion

    }
}
